// house_pkg/pages/room/index.ts
Page({

  /**
   * 页面的初始数据
   */
  data: {
    points: '',
    building: '',
    room: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad({ points, building }) {
    console.log(points, building);
    const room = []
    for (let i = 0; i < 6; i++) {
      room.push(`${this.getRandom(1, 10)}${this.getRandom(1, 10)}${this.getRandom(1, 10)}`)

    }
    // 先实现排序
    room.sort((a, b) => {
      a = +a,
        b = +b
      // 后期根据调整1 和-1 来实现从小到大和从大到小
      return a - b > 0 ? 1 : -1
    })
    this.setData({
      points,
      building,
      room
    })
  },
  // 获取一定范围内的随机整数
  getRandom(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min
  }



})